<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 只有 JS 执行到条件语句，判断条件是成立的才会对条件内的函数赋值，不成立不被赋值只被定义成undefined
        // 函数提升特别要注意的
        // console.log(print())
        // if (true) {
        //     function print() {
        //         console.log('fn4');
        //     }
        // }
        // console.log(print())
        a = 10;
        (function () {
            console.log(a)
            a = 20
            console.log(a)
        })()
        console.log(window.a)
        // 10, 20, 20


    </script>
</body>

</html>